Skip to content
This repository was archived by the owner on Dec 15, 2022. It is now read-only.

Feature proposal: Editable Diff #1882

Open
wants to merge 18 commits into
base: master
Choose a base branch
from

Conversation

vanessayuenn
Copy link
Contributor

@vanessayuenn vanessayuenn commented Jan 4, 2019

This is a work-in-progress feature proposal, started off as a summary of the discussion in #1720. As I did more research and thought more about the execution, however, I realized making a unified diff view editable is quite a bit more challenging than originally anticipated. That probably is why there's no prior art of similar implementation to be found in the wild (all of the editable diff tool uses the split view approach which is covered in this proposal 😄)!

A chat with @simurai this morning has inspired a slightly different direction, which is what this RFC is proposing. I have included the first iteration as well in "Rationale and alternatives" section for the record. The last few sections are TBD at the moment but will be filled out as discussions unfold.


View rendered docs/feature-requests/005-editable-diff.md

@vanessayuenn vanessayuenn added the feature request Propose new features or design label Jan 4, 2019
@vanessayuenn vanessayuenn requested review from simurai and a team January 4, 2019 14:09
@codecov
Copy link

codecov bot commented Jan 4, 2019

Codecov Report

Merging #1882 into master will increase coverage by 0.04%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1882      +/-   ##
==========================================
+ Coverage   92.91%   92.95%   +0.04%     
==========================================
  Files         219      219              
  Lines       12570    12570              
  Branches     1798     1798              
==========================================
+ Hits        11679    11685       +6     
+ Misses        891      885       -6     
Impacted Files Coverage Δ
lib/git-shell-out-strategy.js 99.80% <0.00%> (+0.19%) ⬆️
lib/shared/keytar-strategy.js 58.13% <0.00%> (+0.77%) ⬆️
lib/models/workspace-change-observer.js 97.02% <0.00%> (+3.96%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update f175ae9...161667f. Read the comment docs.

Copy link

@annthurium annthurium left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for writing this up, @vanessayuenn ! It's thorough and you covered a lot of edge cases. Really excited about this feature.

- use grey/void blocks to reconcile the line differences between the two sides so they line up properly

##### Pros:
- it's easy to understand that one side is editable, and the other is not.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

another pro for this approach: some users have asked for split diffs. see #816 and #1423.


- Currently, if a user makes changed to a staged file, the new changes show up in Unstaged Changes, but are not applied to the already staged file. If we allow a staged file to be edited, should the new changes apply to both file on disk as well as the staged entry?

- The PR comments we are implementing in [#1856](https://github.com/atom/github/pull/1856) already add considerable complexity to the diff view. Should the comments be visible when the diff is in an editable state?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe comments should be visible when the diff is in an editable state, because it would be really useful to our users to be able to address comments while also seeing the comments inline.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree. 👍 Reading a comment and then be able to make changes right there without switching to some sort of "edit mode" would be nice.


## :question: Unresolved questions

- Currently, if a user makes changed to a staged file, the new changes show up in Unstaged Changes, but are not applied to the already staged file. If we allow a staged file to be edited, should the new changes apply to both file on disk as well as the staged entry?
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes! Be able to edit staged changes would make the "All staged changes" diff (commit preview) more useful. Like before committing, you might spot a typo and don't have to 1. unstage 2. edit 3. stage again and can directly make the correction. Although it's probably a bit against our "stay true to Git" vision. 😬


- Currently, if a user makes changed to a staged file, the new changes show up in Unstaged Changes, but are not applied to the already staged file. If we allow a staged file to be edited, should the new changes apply to both file on disk as well as the staged entry?

- The PR comments we are implementing in [#1856](https://github.com/atom/github/pull/1856) already add considerable complexity to the diff view. Should the comments be visible when the diff is in an editable state?
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree. 👍 Reading a comment and then be able to make changes right there without switching to some sort of "edit mode" would be nice.


- The PR comments we are implementing in [#1856](https://github.com/atom/github/pull/1856) already add considerable complexity to the diff view. Should the comments be visible when the diff is in an editable state?

- When modifying a diff, should actions such as stage/unstage, jump to file, etc. trigger a "save"?
Copy link
Contributor

@simurai simurai Jan 7, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should actions such as stage/unstage

I'm a bit on the fence, but tend towards a "no". It might depends on the "can staged changes be edited?" question above.

- The cursor for hovering over deleted lines will show up as an arrow as opposed to a text cursor.
- Deleted lines can still be selected (via mouse or keyboard) but no caret will be visible; basically same as current behaviour.
![deleted](https://user-images.githubusercontent.com/378023/50759911-b3fd3680-12a9-11e9-8332-abf211e0743c.gif)
- As a user makes edits in a diff view, the file name will have some visual cue indicating there are unsaved modifications, akin to when a regular atom editor has unsaved changes.
Copy link
Contributor

@simurai simurai Jan 7, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might be useful to also show the modified indicator (blue dot) on the tab? Just like for regular files. Then it's easier to see if a diff has unsaved edits when it's not the active tab or the file header is "scrolled out of view".

screen shot 2019-01-07 at 7 00 08 pm

I might be even enough to only have the indicator on the tabs, even for multi-file diffs.

@vanessayuenn vanessayuenn changed the title [WIP] Feature proposal: Editable Diff Feature proposal: Editable Diff Feb 20, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
feature request Propose new features or design
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants